<template>
  <j-modal
    id="modal"
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <j-form-container :disabled="formDisabled">
        <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
          <a-row>
            <a-col :span="24">
              <a-form-model-item label="审批状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="examineStatus">
                <j-dict-select-tag
                  type="list"
                  v-model="model.examineStatus"
                  dictCode="is_pass"
                  placeholder="请选择审批状态"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="24">
              <a-form-model-item label="审批意见" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="examineOpinion">
                <a-textarea v-model="model.examineOpinion" rows="4" placeholder="请输入审批意见" />
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </j-form-container>
    </a-spin>
  </j-modal>
</template>

<script>
import { postAction } from '../../../api/manage'
export default {
  name: 'ZzzsExamineModal',
  components: {},
  props: {
    visible: false,
    id: '',
    recordId: '',
    recordType: '',
  },
  created() {
    this.model.id = this.id
    this.model.recordId = this.recordId
    this.model.recordType = this.recordType
  },
  data() {
    return {
      title: '',
      width: 800,

      disableSubmit: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      validatorRules: {
        examineStatus: [{ required: true, message: '请选择审批状态!' }],
        examineOpinion: [{ required: true, message: '请输入审批意见!' }],
      },
      url: {
        add: '/modules/zzzsExamine/add',
        edit: '/modules/zzzsExamine/edit',
        queryById: '/modules/zzzsExamine/queryById',
        examineRecordUrl: '/modules/zzzsExamine/examineRecord',
      },
    }
  },
  methods: {
    handleOk() {
      console.log(1)
      postAction(this.url.examineRecordUrl, this.model).then((res) => {
        this.$emit('ok')
      })
    },
    handleCancel() {
      this.$emit('close')
    },
  },
}
</script>
<style>
</style>